﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="notify_class_edit.aspx.cs" Inherits="Ccit.OA.Notify.notify_class_edit" %>
<%@ Register TagPrefix="ccit" Namespace="Ccit.ServerControls" Assembly="Ccit.ServerControls.ActionForm" %>
<%@ Register TagPrefix="FTB" Namespace="FreeTextBoxControls" Assembly="FreeTextBox" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
    <script language="javascript" type="text/javascript" src="../script/jquery.js"></script>
    <script language="javascript" type="text/javascript" src="../script/StringClass_Ext.js"></script>
    <script language="javascript" type="text/javascript" src="../script/jsonlib.js"></script>
    <script language="javascript" src="../script/jwindow.js" type="text/javascript"></script>
    <script language="javascript" src="../script/jcontrol.js" type="text/javascript"></script>
    <script language="javascript" src="../script/jbase64.js" type="text/javascript"></script>
    <script type="text/javascript">
         function doSelUser(vRagneId,vCtrlId,vCtrlName) {
                OpenRangeSelect(vRagneId,vCtrlId,vCtrlName,"1");
          }
          function doSave()
          {
                var vName = document.getElementById("txtName").value;
                if(vName.Trim()!="")
                {
                    var MsNotify = {};
                    MsNotify.id = document.getElementById("_hidsRecId").value;
                    MsNotify.name = vName;
                    MsNotify.rangemark=$get("_hidRangeMarkId").value;
                    MsNotify.range=$get("_hidRange").value;
                    MsNotify.temcontent=$get("freText").value;
                    var rbtn = new RadioList("radioType");
                    MsNotify.state = rbtn.checkedValue;
                    var jsonExpr = JSON.stringify(MsNotify,function(key,value){return value;}); 
                      MsNotify = null;
                    PageMethods.DoSaveMes(jsonExpr,ClientCallBack); 
                }
                else
                {
                    alert("类型名称尚未填写!")
                    return false;
                }
          }
          function ClientCallBack(vResult)
          {
                eval("resultObj ="+vResult)
                if(resultObj.result!="-999")
                {
                    alert(resultObj.message);
                     var isAddNew = ($get("_hidsRecId").value == "") ? "0" : "1";  //是否是新增记录标志  0:是 1:否 
                    switch(resultObj.ctrtype){
                         case "1":
                            $get("_hidsRecId").value = resultObj.result;  
                             var curColObj = {};
                                curColObj.Id = resultObj.result;
                                curColObj.Name = resultObj.Notifyame; 
                                var jsonExpr=JSON.stringify(curColObj,function(key,value){return value;});
                                parent.frames[0].document.getElementById("_hidNewColumnId").value=jsonExpr;                            
                            parent.frames[0].document.getElementById("_hidAddNewSign").value = isAddNew;  //新增记录标志
                            parent.frames[0].document.all.btnTrigger.click();    
                            break;
                         case "2":   
                            var delAddrId = resultObj.result;
                            if(parseInt(delAddrId) > 0) { 
                                parent.frames[0].document.getElementById("_hidUpAddrId").value = delAddrId;
                                parent.frames[0].document.all.btnDelTrigger.click();
                                Clear();
                            }             
                            resultObj = null;  
                            break;  
                    }
                     
                }
                else
                {
                    alert(resultObj.message)
                }
                resultObj = null;
          }
        function  doDelete()
        {
            var sRecId = document.getElementById("_hidsRecId").value;
            if(sRecId!="")
            {
                 if(!confirm("是否删除该类型信息?")){
                                return;                    
                   }
                   else{
                        PageMethods.DoOperate(sRecId,ClientCallBack);		 
                  }
            }
            else
            {
                alert("尚未有您要删除的类型信息!");
                return ;
            }
        }
        function Clear()
        {
             $get("_hidsRecId").value  ="";
             $get("txtName").value  ="";
             $get("_hidRangeMarkId").value  ="";
             $get("_hidRange").value  ="";
             $get("txtRanage").value ="";
             //清空文本编辑器值
             var sContent = "<br>" + ""; 
                 if (freText_HtmlMode) 
                    {
		                freText_editor.document.body.innerText =sContent ;
		                $get("freText").value = freText_editor.document.body.innerText ;
	                } 
	                else 
	                {
		                freText_editor.document.body.innerHTML = sContent;  
		                $get("freText").value =freText_editor.document.body.innerHTML ;
	                }
	                if ($get("freText").value == '<P>&nbsp;</P>') {
		                $get("freText").value = '';
	                } 
             var rbtn = new RadioList("radioType");
                    rbtn.checkedValue = 0;
        }
    </script>
</head>
<body>
    <ccit:ActionForm id="form1" runat="server">
    
    <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
    </asp:ScriptManager> 
          <input type="hidden" id="_hidsRecId" runat="server" />
        <table cellpadding="0" class="tableborder" cellspacing="0" width="98%" align="center" id="tdMessage" runat="server">
            <tr>
			  <td  width="15%" height="14" align="right" class="pformleft"><nobr>类型名称</nobr>			  </td>
				<td  align="left" class="pformright">
				    <asp:TextBox  ID="txtName" Runat="server" CssClass="input" Width="98%"></asp:TextBox>			  				    </td>
			</tr> 
			<tr>
				<td class="pformleft" align="right"><nobr>管理权限
				    <br />
                        <a href="javascript:doSelUser('_hidRangeMarkId','_hidRange','txtRanage')">
                            <img src="../images/toolbar/search.gif" border="0" /></a>                    
				</nobr>			  </td>
				<td  align="left" class="pformright">
                    <nobr>
                    <input type="hidden" id="_hidRangeMarkId" runat="server" />
				    <input type="hidden" id="_hidRange" runat="server" />
                    <asp:TextBox ID="txtRanage" TextMode="MultiLine" Width="98%" Height="60px" 
                        runat="server" ReadOnly="true" CssClass="inputtext"></asp:TextBox>                    
                    </nobr>
				 </td>
			</tr>
			<tr>
				<td class="pformleft" align="right">有效标志
				</td>
				<td   align="left" class="pformright">
                    <nobr>
                         <asp:RadioButtonList ID="radioType" runat="server" Height="16px" 
                        RepeatDirection="Horizontal" Width="158px">
                        <asp:ListItem Value="0" Selected>有效</asp:ListItem>
                        <asp:ListItem Value="1" >无效</asp:ListItem>
                    </asp:RadioButtonList>
				    </nobr>		
			   </td>
			</tr>
			<tr>
				
				<td align="left" class="pformrightline" colspan="2">
                 <FTB:FreeTextBox ID="freText" runat="server" Width="100%" Height="350" 
                 FontFacesMenuPath="../css/"  AllowInsertImage="false" 
                   >               
                 </FTB:FreeTextBox>
			   </td>
			</tr>
         <tr class="pformstrip" height="20">
           <td colspan="2" align="center">
                <input type="button" id="btnSave" value="保存" class="button" onclick="doSave()" />
                &nbsp;
                <input type="button" id="btnSaveCont" value="删除" class="button" onclick="doDelete()" />
                
            </td>
        </tr>
    </table>
    </ccit:ActionForm>      
</body>
</html>
